<?php
$_POST['addtime'] = time();
//1.连接数据库
$link = @mysql_connect('localhost','root','root');
//2.判断连接是否成功
if(!$link){
	die('连接失败');
}
//3.选择数据库
mysql_select_db('team4');
//4.设置字符集
mysql_set_charset('utf8');
//5.准备sql语句
$sql = "insert into liuyan(".implode(',',array_keys($_POST)).") values('".implode("','",$_POST)."')";
//6.发送sql语句
$bool = mysql_query($sql);
//7.判断bool值
if($bool){
	echo '<script>alert("添加成功！");window.location.href="index.php"</script>';
}else{
	echo '<script>alert("添加失败！");window.location.href="index.php"</script>';
}
//8.关闭数据库
mysql_close();